<template>
  <div>
    <h2>各地疫情数据</h2>
    <div class="table">
      <el-table :data="tableData" stripe>
        <el-table-column prop="name" label="地区" width="180">
        </el-table-column>
        <el-table-column prop="total.nowConfirm" sortable label="现存确诊" width="180">
        </el-table-column>
        <el-table-column prop="total.confirm" sortable label="累计确诊" width="180">
        </el-table-column>
        <el-table-column prop="total.dead" sortable label="死亡">
        </el-table-column>
        <el-table-column prop="total.heal" sortable label="治愈">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { getStatisticsChinaAPI } from '@/api/index'
export default {
  name: 'StatisticsChina',
  data() {
    return {
      tableData: []
    }
  },
  created() {
    this.initStatisticsChina()
  },
  methods: {
    // 初始化中国各地疫情数据
    async initStatisticsChina() {
      const { data: res } = await getStatisticsChinaAPI()
      this.tableData = res.data.diseaseh5Shelf.areaTree[0].children
    }
  }
}
</script>

<style lang="less" scoped>
.table {
  width: 70vw;
  margin: 0 auto;
  padding: 20px 20px;
}
</style>
